// 员工管理
import {
    ajaxPostBack,
    ajaxPost,
    download
} from '@/utils/data/request'

// 列表
export function list(params: any) {
    return ajaxPostBack("auth/staff-list", params, {
        cookies: ['yard_sn']
    })
}
// 导出
export function downloadFile(params: any) {
    const file = "人员列表" + Date.now().toString() + '.xls';
    return download('auth/staff-export', params, file, {
        cookies: ['yard_sn'],
        method: 'post'
    });
}

// 新增
export function add(params: any) {
    return ajaxPost("auth/staff-create", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 编辑
export function edit(params: any) {
    return ajaxPost("auth/staff-edit", params, { successMessage: true, cookies: ['yard_sn'] })
}


// 删除
export function del({ staff_sn }: any) {
    return ajaxPost("auth/staff-delete", { staff_sn }, { successMessage: true, cookies: ['yard_sn'] })
}

export function repwd({ staff_sn, staff_password }: any) {
    return ajaxPost("auth/staff-repwd", { staff_sn, staff_password }, { successMessage: true, cookies: ['yard_sn'] })
}

// 设置角色
export function auth({ staff_sn, pc_login, pc_role, app_login, app_role }: any) {
    return ajaxPost("auth/staff-role", { staff_sn, pc_login, pc_role, app_login, app_role }, { successMessage: true, cookies: ['yard_sn'] })
}

// 数据导入
export function importData (params: any) {
    return ajaxPost("auth/staff-import", params, {
      successMessage: true,
      cookies: ["yard_sn"]
    });
}
  